package ynu.edu.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;
import ynu.edu.common.entity.LogicEntity;

import javax.persistence.*;
import java.util.Set;

@Entity
@Getter
@Setter
public class Item extends LogicEntity {
    @Column
    private String name;
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"items"})
    private Business business;
    @OneToMany(mappedBy = "item",
            fetch = FetchType.LAZY,
            orphanRemoval = true,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties(value = {"item"})
    private Set<ShopItem> shopItems;

}
